Music Object Extensibility API

  Contents

Introduction

Starting from version 3.1, the Music Object API has offered additional functionality in the form of optional Music Object extensions. With the release of version 3.3, the API (Application Programming Interface) for writing these extensions became official and public. This section explains the architecture upon which Music Object extensions, language modules, and patches are based and includes a reference to all the methods and properties of the extensibility API.

An Extension Template

The following sample code listing provides a template that can be used as a starting point for creating your own custom Music Object extensions...

Copy-and-Paste
/**********
     TITLE: Music Object Extension - MyExtensionName
   VERSION: 1.0.0
    AUTHOR: Whoever I Am
 COPYRIGHT: 1999 MyCompany, Inc. All Rights Reserved
  REQUIRES: music-object.js (3.2.0 or higher)
**********/

function mo_myInstanceMethod (someParam1,someParam2,someParamN) {
   // some code to implement this instance method
}

function mo_myStaticMethod (someParam1,someParam2,someParamN) {
   // some code to implement this static method
}

/*** Instance Extenders ***/

function mo_addMyExtensionInstanceProperties (ID) {
   ID.myExtensionInstanceProperty1 = false;
   ID.myExtensionInstanceProperty2 = 0;
   //...
   //...
   ID.myExtensionInstancePropertyN = null;
}

Music.addInstanceExtender (mo_addMyExtensionInstanceProperties);

/*** Public Instance Methods ***/

Music.addPublicInstanceMethods ('myInstanceMethod');

/*** Public Static Methods ***/

Music.addPublicStaticMethods ('myStaticMethod');

/*** Public Static Properties ***/

Music.myExtensionStaticProperty1 = false;
Music.myExtensionStaticProperty2 = 0;
//...
//...
Music.myExtensionStaticPropertyN = null;

Extensibility API Reference

 Name   Short Description 
Instance Methods
getPlayer Returns an object reference, being a handle to the player object instance that is supporting the Music Object instance.
setPlayer Lets you set the player object instance that should support the Music Object instance.
Instance Properties
objectName A string variable, indicating the name of the window object's property that can be used to reference the Music Object instance.
volumeScalars An array, containing elements for all of the custom volume scalars that have been created for a Music Object instance.
Static Methods
Music.addEventHandler Lets you attach an additional event handler to an event that may already have a handler registered.
Music.addInstanceExtender Lets you register an extender function that will be called at the time of creation of each Music Object instance.
Music.addKnownClient Lets you add a client profile to the list of supported clients, with the assumption that the extension calling this method may implement code necessary to support the client.
Music.addPrivateInstanceMethods Lets you register the names of private instance methods that should extend each Music Object instance that is created.
Music.addPublicCallbacks Lets you register the names of public instance and static callbacks.
Music.addPublicInstanceMethods Lets you register the names of public instance methods that should extend each Music Object instance that is created.
Music.addPublicStaticMethods Lets you register the names of static methods that should extend the Music Object.
Music.appendToArray Lets you append the elements from one array onto another array.
Music.arrayOfObjects Offers a convenient way to create an array that is populated with a specified object type.
Music.checkForPlayer Lets you coerce the Music Object compatibility layer to check for an installed player.
Music.clearTimeout Lets you clear a timeout that is referenced from a property of a specified name that belongs to a specified object.
Music.execCallback Lets you execute the handler(s) for the specified static callback type.
Music.execHandler Lets you execute the specified handler code, regardless of whether it is specified as a function reference or as a string containing JavaScript.
Music.globalThru Returns a boolean value, indicating whether or not there is a Music Object instance ready through which to pass instructions to query or modify the global state of the audio engine.
Music.indexOf Finds the character position of a substring inside a source string, and returns the string length if the substring is not found.
Music.isInstance Returns a boolean value, indicating whether or not the specified object is a Music Object instance.
Music.meetsMinVersion Returns a boolean value, indicating whether or not a specified version number meets a specified minimum version number.
Music.doNothing A dummy method that does nothing and which can be passed as a parameter to functions or methods that take a function as a parameter.
Music.openWindow Lets you open a centered window of the specified size and properties, for the purposes of displaying prompt dialogs or informational messages.
Music.parseAttributes Lets you easily parse out HTML attributes from a string and return their values in a specified array.
Music.retrieveVersion Lets you extract just the version number out of the specified source string.
Music.setClientInfo Lets you explicitly set the client information that the Music Object compatibility component will use to determine whether or not the client is supported.
Music.stringHasAny Returns a boolean value, indicating whether or not the source string contains any of the specified substrings.
Music.tagAttr Returns a string value, being a name/value pair that is created from a property of a specified name that belongs to a specified object.
Music.wireMethod Lets you wire a Music Object method of a specified name to the specified object.
Static Properties
Music.client An object reference, being a reference to the last element of the Music.knownClients array that was successfully matched against the user's client application.
Music.enableJavaPrompt A static property that can be set in a language module so as to customize the message that appears when the user is prompted to enable Java in their browser.
Music.getPlayerText A static string property, representing the text that should appear in the player control panel substitute when the user needs to install the Beatnik Player.
Music.global A static property, indicating the Music Object instance that can be used to pass through instructions to query or modify the global state of the audio engine.
Music.installPrompt A static property that can be set in a language module so as to customize the message that appears when the user is prompted to install the Beatnik Player.
Music.knownClients An array, representing the list of client applications that are known by the compatibility component of the Music Object API.
Music.minFadeInterval An integer variable, specifying the minimum time interval between updates in the list of active fade tasks.
Music.publicInstanceCallbacks An array, containing the names of all the public instance callback types that have been registered using the Music.addPublicCallbacks static method.
Music.publicStaticCallbacks An array, containing the names of all the public static callback types that have been registered using the Music.addPublicCallbacks static method.
Music.upgradePrompt A static property that can be set in a language module so as to customize the message that appears when the user is prompted to upgrade their player version.
Music.upgradePlayerText A static string property, representing the text that should appear in the player control panel substitute when the user needs to upgrade their player version.
Global Variables
mo_delayPlayerCheck A global variable which, if defined with any value, indicates that the automatic player check should not be carried out at the time that the Music Object API loads and initializes.

Instance Methods

 getPlayer

 
 CATEGORY   Extensibility API Instance Method 
 MODULE   Music Object Core 
 Music Object Component - Advanced 
 

The getPlayer instance method returns an object reference, being a handle to the player object instance that is supporting the Music Object instance.

SYNTAX    getPlayer ( )

RETURN VALUE    OBJECT

 setPlayer

 
 CATEGORY   Extensibility API Instance Method 
 MODULE   Music Object Core 
 Music Object Component - Advanced 
 

The setPlayer instance method lets you set the player object instance that should support the Music Object instance.

SYNTAX    setPlayer ( PlayerReferenceOBJ )

Instance Properties

 objectName

 
 CATEGORY   Extensibility API Instance Property 
 MODULE   Music Object Core
 Music Object Component - Basic 
 Access   read only 
 

The objectName instance property is a string variable, indicating the name of the window object's property that can be used to reference the Music Object instance.

 volumeScalars

 
 CATEGORY   Extensibility API Instance Property 
 MODULE   Music Object Core
 Music Object Component - Basic 
 Access   read / write 
 

The volumeScalars instance property is an array, containing elements for all of the custom volume scalars that have been created for a Music Object instance.

Static Methods

 Music.addEventHandler

 
 CATEGORY   Extensibility API Static Method 
 MODULE   Music Object Core
 Music Object Component - Basic 
 

The Music.addEventHandler static method lets you attach an additional event handler to an event that may already have a handler registered.

SYNTAX    Music.addEventHandler ( WindowOBJ , HtmlElementOBJ , EventTypeSTR , EventHandlerJavaScriptSTR )

NOTES
 Music.addInstanceExtender

 
 CATEGORY   Extensibility API Static Method 
 MODULE   Music Object Core
 Music Object Component - Advanced 
 

The Music.addInstanceExtender static method lets you register an extender function that will be called at the time of creation of each Music Object instance.

SYNTAX    Music.addInstanceExtender ( ExtenderFunction )

 Music.addKnownClient

 
 CATEGORY   Extensibility API Static Method 
 MODULE   Music Object Core
 Music Object Component - Compatibility 
 

The Music.addKnownClient static method lets you add a client profile to the list of supported clients, with the assumption that the extension calling this method may implement code necessary to support the client.

SYNTAX    Music.addKnownClient ( ClientNameSTR , ClientPlatformSTR , ClientMinVersionSTR , ClientIsUpgradableBOOL )

VARIATIONS
 Music.addPrivateInstanceMethods

 
 CATEGORY   Extensibility API Static Method 
 MODULE   Music Object Core
 Music Object Component - Basic 
 

The Music.addPrivateInstanceMethods static method lets you register the names of private instance methods that should extend each Music Object instance that is created.

SYNTAX    Music.addPrivateInstanceMethods ( MethodName1STR , MethodName2STR , ... , MethodNameNSTR )

 Music.addPublicCallbacks

 
 CATEGORY   Extensibility API Static Method 
 MODULE   Music Object Core
 Music Object Component - Advanced 
 

The Music.addPublicCallbacks static method lets you register the names of public instance and static callbacks.

SYNTAX    Music.addPublicCallbacks ( CallbackName1STR , CallbackName2STR , ... , CallbackNameNSTR )

 Music.addPublicInstanceMethods

 
 CATEGORY   Extensibility API Static Method 
 MODULE   Music Object Core
 Music Object Component - Basic 
 

The Music.addPublicInstanceMethods static method lets you register the names of public instance methods that should extend each Music Object instance that is created.

SYNTAX    Music.addPublicInstanceMethods ( MethodName1STR , MethodName2STR , ... , MethodNameNSTR )

 Music.addPublicStaticMethods

 
 CATEGORY   Extensibility API Static Method 
 MODULE   Music Object Core
 Music Object Component - Basic 
 

The Music.addPublicStaticMethods static method lets you register the names of static methods that should extend the Music Object.

SYNTAX    Music.addPublicStaticMethods ( MethodName1STR , MethodName2STR , ... , MethodNameNSTR )

 Music.appendToArray

 
 CATEGORY   Extensibility API Static Method 
 MODULE   Music Object Core
 Music Object Component - Advanced 
 

The Music.appendToArray static method lets you append the elements from one array onto another array.

SYNTAX    Music.appendToArray ( DestinationArrayOBJ , SourceArrayOBJ )

 Music.arrayOfObjects

 
 CATEGORY   Extensibility API Static Method 
 MODULE   Music Object Core
 Music Object Component - Advanced 
 

The Music.arrayOfObjects static method offers a convenient way to create an array that is populated with a specified object type.

SYNTAX    Music.arrayOfObjects ( TotalInstancesINT , ObjectConstructorFunction )

 Music.checkForPlayer

 
 CATEGORY   Extensibility API Static Method 
 MODULE   Music Object Core
 Music Object Component - Compatibility 
 

The Music.checkForPlayer static method lets you coerce the Music Object compatibility layer to check for an installed player.

SYNTAX    Music.checkForPlayer ( )

 Music.clearTimeout

 
 CATEGORY   Extensibility API Static Method 
 MODULE   Music Object Core
 Music Object Component - Advanced 
 

The Music.clearTimeout static method lets you clear a timeout that is referenced from a property of a specified name that belongs to a specified object.

SYNTAX    Music.clearTimeout ( TimeoutOwnerOBJ , TimeoutPropertyNameSTR )

 Music.doNothing

 
 CATEGORY   Extensibility API Static Method 
 MODULE   Music Object Core
 Music Object Component - Basic 
 

The Music.doNothing static method is a dummy function that does nothing and which can be passed as a parameter to functions or methods that take a function as a parameter.

SYNTAX    Music.doNothing ( )

 Music.execCallback

 
 CATEGORY   Extensibility API Static Method 
 MODULE   Music Object Core
 Music Object Component - Advanced 
 

The Music.execCallback static method lets you execute the handler(s) for the specified static callback type.

SYNTAX    Music.execCallback ( StaticCallbackTypeSTR )

 Music.execHandler

 
 CATEGORY   Extensibility API Static Method 
 MODULE   Music Object Core
 Music Object Component - Advanced 
 

The Music.execHandler static method lets you execute the specified handler code, regardless of whether it is specified as a function reference or as a string containing JavaScript.

SYNTAX    Music.execHandler ( HandlerJavaScriptSTR )

VARIATIONS
 Music.globalThru

 
 CATEGORY   Extensibility API Static Method 
 MODULE   Music Object Core
 Music Object Component - Basic 
 

The Music.globalThru static method returns a boolean value, indicating whether or not there is a Music Object instance ready through which to pass instructions to query or modify the global state of the audio engine.

SYNTAX    Music.globalThru ( )

 Music.indexOf

 
 CATEGORY   Extensibility API Static Method 
 MODULE   Music Object Core
 Music Object Component - Basic 
 

The Music.indexOf static method finds the character position of a substring inside a source string, and returns the string length if the substring is not found.

SYNTAX    Music.indexOf ( SourceSTR , SearchSTR , StartPosINT )

 Music.isInstance

 
 CATEGORY   Extensibility API Static Method 
 MODULE   Music Object Core
 Music Object Component - Advanced 
 

The Music.isInstance static method returns a boolean value, indicating whether or not the specified object is a Music Object instance.

SYNTAX    Music.isInstance ( ObjectToTestOBJ )

 Music.meetsMinVersion

 
 CATEGORY   Extensibility API Static Method 
 MODULE   Music Object Core
 Music Object Component - Compatibility 
 

The Music.meetsMinVersion static method returns a boolean value, indicating whether or not a specified version number meets a specified minimum version number.

SYNTAX    Music.meetsMinVersion ( VersionToTestSTR , MinRequiredVersionSTR )

 Music.openWindow

 
 CATEGORY   Extensibility API Static Method 
 MODULE   Music Object Core
 Music Object Component - Compatibility 
 

The Music.openWindow static method lets you open a centered window of the specified size and properties, for the purposes of displaying prompt dialogs or informational messages.

SYNTAX    Music.openWindow (
    FileUrlSTR ,
    WindowNameSTR ,
    WindowWidthINT ,
    WindowHeightINT ,
    ShowStatusBarBOOL ,
    WindowPropertiesSTR ,
    WindowLeftPositionINT ,
    WindowTopPositionINT
)

SPECIAL VALUES
VARIATIONS
NOTES
 Music.parseAttributes

 
 CATEGORY   Extensibility API Static Method 
 MODULE   Music Object Core
 Music Object Component - Basic 
 

The Music.parseAttributes static method lets you easily parse out HTML attributes from a string and return their values in a specified array.

SYNTAX    Music.parseAttributes ( HtmlAttributesSTR , AttributesOwnerOBJ )

 Music.retrieveVersion

 
 CATEGORY   Extensibility API Static Method 
 MODULE   Music Object Core
 Music Object Component - Compatibility 
 

The Music.retrieveVersion static method lets you extract just the version number out of the specified source string.

SYNTAX    Music.retrieveVersion ( SourceSTR )

 Music.setClientInfo

 
 CATEGORY   Extensibility API Static Method 
 MODULE   Music Object Core
 Music Object Component - Compatibility 
 

The Music.setClientInfo static method lets you explicitly set the client information that the Music Object compatibility component will use to determine whether or not the client is supported.

SYNTAX    Music.setClientInfo ( AppNameSTR , AppVersionSTR , PlatformSTR , UserAgentSTR )

SPECIAL VALUES
VARIATIONS
 Music.stringHasAny

 
 CATEGORY   Extensibility API Static Method 
 MODULE   Music Object Core
 Music Object Component - Compatibility 
 

The Music.stringHasAny static method returns a boolean value, indicating whether or not the source string contains any of the specified substrings.

SYNTAX    Music.stringHasAny ( SourceSTR , Substring1STR , Substring2STR , ... , SubstringNSTR )

 Music.tagAttr

 
 CATEGORY   Extensibility API Static Method 
 MODULE   Music Object Core
 Music Object Component - Advanced 
 

The Music.tagAttr static method returns a string value, being a name/value pair that is created from a property of a specified name that belongs to a specified object.

SYNTAX    Music.tagAttr ( PropertyOwnerOBJ , PropertyNameSTR )

 Music.wireMethod

 
 CATEGORY   Extensibility API Static Method 
 MODULE   Music Object Core
 Music Object Component - Advanced 
 

The Music.wireMethod static method lets you wire a Music Object method of a specified name to the specified object.

SYNTAX    Music.wireMethod ( MethodOwnerOBJ , MethodNameSTR )

Static Properties

 Music.client

 
 CATEGORY   Extensibility API Static Property 
 MODULE   Music Object Core
 Music Object Component - Compatibility 
 Access   read only 
 

The Music.client static property is an object reference, being a reference to the last element of the Music.knownClients array that was successfully matched against the user's client application.

 Music.enableJavaPrompt

 
 CATEGORY   Extensibility API Static Property 
 MODULE   Music Object Core
 Music Object Component - Compatibility 
 Access   read / write 
 

The Music.enableJavaPrompt static property is a reference to a function and can be set in a language module so as to customize the message that appears when the user is prompted to enable Java in their browser.

For more information on using this property in conjunction with other Extensibility API properties in the creation of custom language modules, consult the section Creating Your Own Language Modules.

 Music.getPlayerText

 
 CATEGORY   Extensibility API Static Property 
 MODULE   Music Object Core
 Music Object Component - Compatibility 
 Access   read / write 
 

The Music.getPlayerText static property is a string, representing the text that should appear in the player control panel substitute when the user needs to install the Beatnik Player.

 Music.global

 
 CATEGORY   Extensibility API Static Property 
 MODULE   Music Object Core
 Music Object Component - Basic 
 Access   read only 
 

The Music.global static property is an object reference, indicating the Music Object instance that can be used to pass through instructions to query or modify the global state of the audio engine.

 Music.installPrompt

 
 CATEGORY   Extensibility API Static Property 
 MODULE   Music Object Core
 Music Object Component - Compatibility 
 Access   read / write 
 

The Music.installPrompt static property is a reference to a function and can be set in a language module so as to customize the message that appears when the user is prompted to install the Beatnik Player.

For more information on using this property in conjunction with other Extensibility API properties in the creation of custom language modules, consult the section Creating Your Own Language Modules.

 Music.knownClients

 
 CATEGORY   Extensibility API Static Property 
 MODULE   Music Object Core
 Music Object Component - Compatibility 
 Access   read only 
 

The Music.knownClients static property is an array, representing the list of client applications that are known by the compatibility component of the Music Object API.

 Music.minFadeInterval

 
 CATEGORY   Extensibility API Static Property 
 MODULE   Music Object Core
 Music Object Component - Advanced 
 Access   read / write 
 

The Music.minFadeInterval static property is an integer variable, specifying the minimum time interval between updates in the list of active fade tasks.

 Music.publicInstanceCallbacks

 
 CATEGORY   Extensibility API Static Property 
 MODULE   Music Object Core
 Music Object Component - Advanced 
 Access   read only 
 

The Music.publicInstanceCallbacks static property is an array, containing the names of all the public instance callback types that have been registered using the Music.addPublicCallbacks static method.

 Music.publicStaticCallbacks

 
 CATEGORY   Extensibility API Static Property 
 MODULE   Music Object Core
 Music Object Component - Advanced 
 Access   read only 
 

The Music.publicStaticCallbacks static property is an array, containing the names of all the public static callback types that have been registered using the Music.addPublicCallbacks static method.

 Music.upgradePlayerText

 
 CATEGORY   Extensibility API Static Property 
 MODULE   Music Object Core
 Music Object Component - Compatibility 
 Access   read / write 
 

The static property is a string, representing the text that should appear in the player control panel substitute when the user needs to upgrade their player version.

 Music.upgradePrompt

 
 CATEGORY   Extensibility API Static Property 
 MODULE   Music Object Core
 Music Object Component - Compatibility 
 

The Music.upgradePrompt static property is a reference to a function and can be set in a language module, so as to customize the message that appears when the user is prompted to upgrade their player version.

For more information on using this property in conjunction with other Extensibility API properties in the creation of custom language modules, consult the section Creating Your Own Language Modules.

Global Variables

 mo_delayPlayerCheck

 
 CATEGORY   Extensibility API Static Property 
 MODULE   Music Object Core
 Music Object Component - Compatibility 
 Access   read / write 
 

The mo_delayPlayerCheck global variable, if defined with any value, indicates that the automatic player check should not be carried out at the time that the Music Object API loads and initializes.

How Extensibility API Features are Divided Between the Core Components

The following table illustrates how the features (methods and properties) of the Music Object Extensibility API are broken up between the three core components. Each column of the table represents a core component, and each row in the table represents a type of extensibility feature (instance methods, static methods, instance properties, and static properties).

IMPORTANT
For information on how the features of the Music Object public authoring API are divided between the different core components, consult the section How Features are Divided Between the Core Components.

Basic Component Advanced Component Compatibility Component
Instance Methods
  getPlayer
setPlayer
 
Static Methods
  Music.addEventHandler
Music.addInstanceExtender
Music.addPrivateInstanceMethods
Music.addPublicCallbacks
Music.addPublicInstanceMethods
Music.addPublicStaticMethods
Music.appendToArray
Music.arrayOfObjects
Music.clearTimeout
Music.doNothing
Music.execCallback
Music.execHandler
Music.globalThru
Music.indexOf
Music.isInstance
Music.parseAttributes
Music.tagAttr
Music.wireMethod
Music.addKnownClient
Music.checkForPlayer
Music.meetsMinVersion
Music.openWindow
Music.retrieveVersion
Music.setClientInfo
Music.stringHasAny
Instance Properties
objectName
volumeScalars
   
Static Properties
Music.global
Music.minFadeInterval
Music.publicInstanceCallbacks
Music.publicStaticCallbacks
Music.client
Music.enableJavaPrompt
Music.getPlayerText
Music.installPrompt
Music.knownClients
Music.upgradePrompt
Music.upgradePlayerText
Global Variables
    mo_delayPlayerCheck